package com.yanqu.road.server.cmd.activity.summerquiz;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.SummerQuizProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.activity.summerquiz.CrossSummerQuizActivity;
import com.yanqu.road.server.manager.activity.summerquiz.CrossSummerQuizMgr;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.C_SUMMER_QUIZ_RELOAD_CONFIG, desc = "重载配置")
public class CrossSummerQuizReloadConfigCmd extends CrossCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        SummerQuizProto.CrossSummerQuizReloadConfigReqMsg reqMsg = SummerQuizProto.CrossSummerQuizReloadConfigReqMsg.parseFrom(packet.getBytes());
        int activityId = reqMsg.getActivityId();
        CrossSummerQuizActivity quizActivity = CrossSummerQuizMgr.getActivityIfNull(activityId);
        if(quizActivity != null){
            quizActivity.initConfig();
        }
    }

    @Override
    public void sendData() {

    }
}
